import {useState} from 'react';
import {Tabs} from 'antd'
import ProductInfo from './ProductInfo.tsx'
import InsuranceInfo from './InsuranceInfo.tsx'
const ProductionAdd = () => {
    const items: {
        label: string; children: string; key: string | undefined;
    }[] = [
        {label: '产品信息', key: '产品信息', children: ''},
        {label: '险种信息', key: '险种信息', children: ''},
        {label: "费率表", key: "费率表", children: ''},
        {label: "保险责任", key: "保险责任", children: ''},
        {label: "健康告知", key: "健康告知", children: ''},
        {label: "保险资料", key: "保险资料", children: ''},
        {label: "数据字典", key: "数据字典", children: ''},
        {label: "投保规则", key: "投保规则", children: ''},
        {label: "投保流程", key: "投保流程", children: ''},
        {label: "保全流程", key: "保全流程", children: ''},
        {label: "黑白名单", key: "黑白名单", children: ''},
        {label: "利益演示", key: "利益演示", children: ''},
        {label: "营销管理", key: "营销管理", children: ''},
    ]
    const nextStep = () => {
        const currentIndex = items.findIndex(item => item.key === activeKey);
        setActiveKey(items[currentIndex + 1].key)
    }
    const [activeKey, setActiveKey] = useState(items[0].key);
    const renderContent = () => {
        if (activeKey==='产品信息'){
            return <ProductInfo nextStep={nextStep}/>
        }else if (activeKey === '险种信息') {
            return <InsuranceInfo nextStep={nextStep} />
        }
        // if (userRole === 'admin') {
        //     return (
        //         <>
        //             <AdminPanel />
        //             <ActivityLog />
        //         </>
        //     );
        // }
        //
        // if (userRole === 'editor' && permissions.includes('publish')) {
        //     return <EditorTools />;
        // }
        //
        // if (userRole === 'viewer') {
        //     return <ReadOnlyView />;
        // }
        //
        // return <DefaultDashboard />;
    };
    const onChange = (key: string) => {
        setActiveKey(key);
    }
    return (
        <div>
            <Tabs
                className="tabs-custom"
                type="card"
                items={items}
                activeKey={activeKey}
                onChange={onChange}
            />
            {renderContent()}
        </div>
    );
};

export default ProductionAdd;